FindFirst a atribut ARCHIVE
Otázka od: Ludek ZITA
21. 6. 2004 9:20
Zdravim.
Hledam soubory FindFirst/FindNext a mam problem s tim, ze soubor, ktery
ma smaznuty vsechny atributy nenajdu zadnou kombinaci attributu.
V sysutils jsou definovany tyto konstanty :
faReadOnly = $00000001 platform;
faHidden = $00000002 platform;
faSysFile = $00000004 platform;
faVolumeID = $00000008 platform;
faDirectory = $00000010;
faArchive = $00000020 platform;
faAnyFile = $0000003F;
Zkusil jsem do sveho projektu pridat jeste
faNoArchiveFile = $00000080;
faMyAnyFile=$000000FF;
No a zda se ze to funnguje (viz upraveny priklad z helpu)
Myslite ze je to spravne, resp mohl by to nekdo zkusit na jinem systemu
(W98, XP,XPHome).
Ja to mam na W2000 profi
Diky
Ludek
procedure TForm1.Button1Click(Sender: TObject);
var
sr: TSearchRec;
FileAttrs: Integer;
begin
StringGrid1.RowCount := 1;
if CheckBox1.Checked then
FileAttrs := faReadOnly
else
FileAttrs := 0;
if CheckBox2.Checked then
FileAttrs := FileAttrs + faHidden;
if CheckBox3.Checked then
FileAttrs := FileAttrs + faSysFile;
if CheckBox4.Checked then
FileAttrs := FileAttrs + faVolumeID;
if CheckBox5.Checked then
FileAttrs := FileAttrs + faDirectory;
if CheckBox6.Checked then
FileAttrs := FileAttrs + faArchive;
if CheckBox7.Checked then
FileAttrs := FileAttrs + faAnyFile;
// dodano
if CheckBox8.Checked then
FileAttrs := FileAttrs + faNoArchiveFile;
if CheckBox9.Checked then
FileAttrs := FileAttrs + faMyAnyFile;
// dodano
with StringGrid1 do
begin
RowCount := 0;
if FindFirst(Edit1.Text, FileAttrs, sr) = 0 then
begin
repeat
if (sr.Attr and FileAttrs) = sr.Attr then
begin
RowCount := RowCount + 1;
Cells[1,RowCount-1] := sr.Name;
Cells[2,RowCount-1] := IntToStr(sr.Size);
end;
until FindNext(sr) <> 0;
FindClose(sr);
end;
end;
end;